<?php

namespace Summer\Location\Http\Controllers;

use Illuminate\Routing\Controller;
use Summer\Hub\Http\Controllers\Traits\ApiReturn;
use Summer\Location\Models\CityModel;
use Summer\Location\Models\ProvinceModel;
use Input;
use Db;

class CityController extends Controller
{
    use ApiReturn;

    public function index(){
        $province_code=Input::get('province_code');
        if(!$province_code){
            return $this->apiError('请选择省份');
        }
        $province=ProvinceModel::where('code',$province_code)->first();
        if(!$province){
            return $this->apiError('查找失败');
        }
        $rdata=CityModel::getNameList($province);
        return $this->apiSuccess('操作成功',$rdata);
    }
}
